package vn.fpt.fsoft.entities;




import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Author:	DuongPV1
 * Entity ContactType mapping with table ContactType in database
 * 
 * */
@Entity
@Table(name="ContactType")
public class ContactType implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5168062977595135052L;
	private int contactTypeId;
	private String type;
	private Set<Contact> contacts = new HashSet<Contact>(0);

	public ContactType() {
		// TODO Auto-generated constructor stub
	}
	
	
	
	
	/**
	 * @param contactTypeId
	 * @param type
	 * @param contacts
	 */
	public ContactType(int contactTypeId, String type, Set<Contact> contacts) {
		super();
		this.contactTypeId = contactTypeId;
		this.type = type;
		this.contacts = contacts;
	}




	@Id
	@GeneratedValue
	@Column(name="ContactTypeId",nullable=false,unique=true)
	public int getContactTypeId() {
		return contactTypeId;
	}

	public void setContactTypeId(int contactTypeId) {
		this.contactTypeId = contactTypeId;
	}
	@Column(name="Type",nullable=true,length=50)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	@OneToMany(fetch=FetchType.LAZY,mappedBy="contactType")
	public Set<Contact> getContacts() {
		return contacts;
	}

	public void setContacts(Set<Contact> contacts) {
		this.contacts = contacts;
	}
	

}
